<template>
    <div class="nav-contaienr">
        <div class="list">
            <div class="item" :class="active.name === item.name ? 'item__active' : ''" :key="item.name" v-for="item in list" @click="active = item">
                <img :src="item.icon" alt="">
                <span>{{item.name}}</span>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "PublicNav",
        data() {
            return {
                active: {name: ''},
                list: [
                    {name: '电子地图', icon: require('@/assets/img/nav1.png')},
                    {name: '设备管理', icon: require('@/assets/img/nav2.png')},
                    {name: '报警管理', icon: require('@/assets/img/nav3.png')},
                    {name: '巡线管理', icon: require('@/assets/img/nav4.png')},
                    {name: '数据查询', icon: require('@/assets/img/nav5.png')},
                    {name: '系统管理', icon: require('@/assets/img/nav6.png')},
                ]
            }
        }
    }
</script>

<style scoped lang="scss">
.nav-contaienr{
    width: 1246px;
    height: 38px;
    position: absolute;
    left: 0;
    right: 0;
    margin: 0 auto;
    top: 90px;
    z-index: 20;
    .list{
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        .item{
            width: 188px;
            height: 38px;
            background: url("~@/assets/img/btn.png") no-repeat center;
            line-height: 44px;
            text-align: center;
            font-size: 16px;
            color: #00d4ff;
            cursor: pointer;
            img{
                position: relative;
                top: 2px;
            }
            span{
                margin-left: 5px;
                position: relative;
                top: -3px;
            }
        }
        .item__active{
            background: url("~@/assets/img/btn-active.png") no-repeat center;
        }
    }
}
</style>
